package com.xq.shop.dao.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.xq.shop.dao.IPrivilegeDAO;
import com.xq.shop.po.Privilege;
import com.xq.shop.util.HibernateUtil;

@Repository
@SuppressWarnings("unchecked")
public class PrivilegeDAO extends BaseDAO<Privilege> implements IPrivilegeDAO {

	@Override
	public List<Privilege> getByMenu(final List<Long> menuIDs) {

		if(menuIDs == null || menuIDs.size() < 1) return new ArrayList<Privilege>();
		
		Map<String, Object> param = new HashMap<String, Object>();
		param.put("ids", menuIDs);
		return (List<Privilege>) HibernateUtil.executeFind(" from Privilege where menu_id in (:ids)", param);
	}
}
